package com.easy.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.easy.common.bean.SysUser;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<SysUser> {
    @Delete("delete from sys_user_role where user_id=#{userid}")
    int deleteUserRoleByUserID(@Param("userid") Integer userid);
    @Insert("insert into sys_user_role value (#{userid},#{roleid})")
    int insertUserRole(@Param("userid")Integer userid,@Param("roleid")Integer roleid);
    @Select("select * from sys_user where username=#{username}")
    SysUser getByUsername(@Param("username")String username);

    @Select("SELECT role_id FROM sys_user_role WHERE user_id = #{userId}")
    List<Integer> getRoleIdsByUserId(@Param("userId") Integer userId);
}
